/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.agenda.model.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ronildo
 */
@Entity
@Table(name = "AM_TB_TELE_PACI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AmTbTelePaci.findAll", query = "SELECT a FROM AmTbTelePaci a"),
    @NamedQuery(name = "AmTbTelePaci.findByCdUsuaPaci", query = "SELECT a FROM AmTbTelePaci a WHERE a.amTbTelePaciPK.cdUsuaPaci = :cdUsuaPaci"),
    @NamedQuery(name = "AmTbTelePaci.findByNrSequTele", query = "SELECT a FROM AmTbTelePaci a WHERE a.amTbTelePaciPK.nrSequTele = :nrSequTele"),
    @NamedQuery(name = "AmTbTelePaci.findByNrDdd", query = "SELECT a FROM AmTbTelePaci a WHERE a.nrDdd = :nrDdd"),
    @NamedQuery(name = "AmTbTelePaci.findByNrTele", query = "SELECT a FROM AmTbTelePaci a WHERE a.nrTele = :nrTele")})
public class AmTbTelePaci implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AmTbTelePaciPK amTbTelePaciPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NR_DDD")
    private short nrDdd;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NR_TELE")
    private long nrTele;
    @JoinColumn(name = "CD_TIPO_TELE", referencedColumnName = "CD_TIPO_TELE")
    @ManyToOne(optional = false)
    private AmTbTipoTele cdTipoTele;
    @JoinColumn(name = "CD_USUA_PACI", referencedColumnName = "CD_USUA_PACI", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private AmTbPaci amTbPaci;

    public AmTbTelePaci() {
    }

    public AmTbTelePaci(AmTbTelePaciPK amTbTelePaciPK) {
        this.amTbTelePaciPK = amTbTelePaciPK;
    }

    public AmTbTelePaci(AmTbTelePaciPK amTbTelePaciPK, short nrDdd, long nrTele) {
        this.amTbTelePaciPK = amTbTelePaciPK;
        this.nrDdd = nrDdd;
        this.nrTele = nrTele;
    }

    public AmTbTelePaci(int cdUsuaPaci, short nrSequTele) {
        this.amTbTelePaciPK = new AmTbTelePaciPK(cdUsuaPaci, nrSequTele);
    }

    public AmTbTelePaciPK getAmTbTelePaciPK() {
        return amTbTelePaciPK;
    }

    public void setAmTbTelePaciPK(AmTbTelePaciPK amTbTelePaciPK) {
        this.amTbTelePaciPK = amTbTelePaciPK;
    }

    public short getNrDdd() {
        return nrDdd;
    }

    public void setNrDdd(short nrDdd) {
        this.nrDdd = nrDdd;
    }

    public long getNrTele() {
        return nrTele;
    }

    public void setNrTele(long nrTele) {
        this.nrTele = nrTele;
    }

    public AmTbTipoTele getCdTipoTele() {
        return cdTipoTele;
    }

    public void setCdTipoTele(AmTbTipoTele cdTipoTele) {
        this.cdTipoTele = cdTipoTele;
    }

    public AmTbPaci getAmTbPaci() {
        return amTbPaci;
    }

    public void setAmTbPaci(AmTbPaci amTbPaci) {
        this.amTbPaci = amTbPaci;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (amTbTelePaciPK != null ? amTbTelePaciPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AmTbTelePaci)) {
            return false;
        }
        AmTbTelePaci other = (AmTbTelePaci) object;
        if ((this.amTbTelePaciPK == null && other.amTbTelePaciPK != null) || (this.amTbTelePaciPK != null && !this.amTbTelePaciPK.equals(other.amTbTelePaciPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.agenda.model.entity.AmTbTelePaci[ amTbTelePaciPK=" + amTbTelePaciPK + " ]";
    }
    
}
